import path = require("path");
import * as vscode from 'vscode';

export default class Utils {
    /**根目录 */
    static get root() {
        return path.join(__dirname, "../../");
    }

    static showOutPut() {}

    /**
     * 计算文本行数
     * @param str 文本
     * @param lineChar 单行字符数
     */
    static getTextLine(str: string, lineChar: number): number {
        let _line = 1;
        let _count = 0;
        for (let i = 0; i < str.length; i++) {
            const _s = str[i];
            _count++;
            if (_s === "\n" || _count === lineChar) {
                _line++;
                _count = 0;
            }
        }
        return _line;
    }
}